import urllib.request
import urllib.parse
# https://www.baidu.com/s?ie=UTF-8&wd=%E5%8D%83%E4%B8%8E%E5%8D%83%E5%AF%BB

url = "https://www.baidu.com/s?ie=UTF-8&wd="
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36'
}
name = "千与千寻"
result = urllib.parse.quote(name)
url = url + result

request = urllib.request.Request(url=url, headers=headers)
response = urllib.request.urlopen(request)
content = response.read().decode('utf8')
print(content)